import Vue from "vue";
import VueRouter from "vue-router";
// 引入首页
import Home from "@/views/home"
// 引入分类
import List from "@/views/list"
// 引入购物车
import Cart from "@/views/cart"
// 引入个人中心
import My from "@/views/my"
//登陆注册组件
import LRcom from "@/views/LRcom"
// //登陆组件
import Login from "@/views/login"
// //注册组件
import Reg from "@/views/reg"
//引入商品列表
import goodlist from "@/views/list/goodlist.vue"
//引入商品详情页
import details from "@/views/list/details.vue"
//引入详情图片页
import xqimg from "@/views/list/xqimg.vue"
//引入首页搜索
import Seach from "@/views/seach"
//修改信息页
import Modify from "@/views/modify"
//搜索框
import indexcardList from "@/views/indexcardList"

Vue.use(VueRouter);

const routes = [

  {
    path: "/",
    redirect: "home"  //进入时重定向默认为users
  },
  {
    path: "/home",
    name: "home",
    component: Home
  },
  {
    path: "/home/seach",
    name: "seach",
    component: Seach
  },
  {
    path: "/home/indexcardlist",
    name: "indexcardlist",
    component: indexcardList,
  },
  {
    path: "/list",
    name: "list",
    component: List,
  },
  {
    path: '/list/goodlist',
    name: "goodlist",
    component: goodlist
  },
  {
    path: '/details',
    name: "details",
    component: details
  },
  {
    path: '/xqimg',
    name: "xqimg",
    component: xqimg
  },
  {
    path: "/cart",
    name: "cart",
    component: Cart
  },
  {
    path: "/my",
    name: "my",
    component: My,

  }, {
    path: '/modify',
    name: 'modify',
    component: Modify
  },
  {
    path: "/LRcom",
    name: "LRcom",
    component: LRcom,
    redirect: "/LRcom/reg",
    // 子路由
    children: [
      {
        path: 'login',
        name: 'login',
        component: Login,
        // redirect: "/LRcom/Login",
      },
      {
        path: 'reg',
        name: 'reg',
        component: Reg,
        // redirect: "/LRcom/reg",
      }
    ]
  },

];

const router = new VueRouter({
  routes,
  mode: "history"  //去除路径后的#号
});

export default router;
